package dao;

import util.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import bean.Remito;

public class RemitoDAO 
{
	private static RemitoDAO instancia = null;
	private static SessionFactory sf = null;

	public static RemitoDAO getInstancia()
	{
		if(instancia == null)
		{
			sf = HibernateUtil.getSessionFactory();
			instancia = new RemitoDAO();
		} 
		return instancia;
	}

	public void grabarRemito(Remito nuevoRemito) 
	{
		Session session = sf.openSession();
		session.beginTransaction();
		
		session.persist(nuevoRemito);
		
		session.flush();
		session.getTransaction().commit();
		session.close();
	}
	
	
}
